{% extends 'EnsJobeetBundle::layout.html.twig' %}

{% block title %}
Jobs in the {{ category.name }} category
{% endblock %}

{% block stylesheets %}
  {{ parent() }}
<link rel="stylesheet" href="{{ asset('bundles/ensjobeet/css/jobs.css') }}" type="text/css" media="all" />
{% endblock %}

{% block content %}
<div class="category">
    <div class="feed">
        <a href="">Feed</a>
    </div>
    <h1>{{ category.name }}</h1>
</div>

  {% include 'EnsJobeetBundle:Job:list.html.twig' with {'jobs': category.activejobs} %}

  {% if last_page > 1 %}
<div class="pagination">
    <a href="{{ path('EnsJobeetBundle_category', { 'slug': category.slug, 'page': 1 }) }}">
        <img src="{{ asset('bundles/ensjobeet/images/first.png') }}" alt="First page" title="First page" />
    </a>

    <a href="{{ path('EnsJobeetBundle_category', { 'slug': category.slug, 'page': previous_page }) }}">
        <img src="{{ asset('bundles/ensjobeet/images/previous.png') }}" alt="Previous page" title="Previous page" />
    </a>

      {% for page in 1..last_page %}
        {% if page == current_page %}
          {{ page }}
        {% else %}
    <a href="{{ path('EnsJobeetBundle_category', { 'slug': category.slug, 'page': page }) }}">{{ page }}</a>
        {% endif %}
      {% endfor %}

    <a href="{{ path('EnsJobeetBundle_category', { 'slug': category.slug, 'page': next_page }) }}">
        <img src="{{ asset('bundles/ensjobeet/images/next.png') }}" alt="Next page" title="Next page" />
    </a>

    <a href="{{ path('EnsJobeetBundle_category', { 'slug': category.slug, 'page': last_page }) }}">
        <img src="{{ asset('bundles/ensjobeet/images/last.png') }}" alt="Last page" title="Last page" />
    </a>
</div>
  {% endif %}

<div class="pagination_desc">
    <strong>{{ total_jobs }}</strong> jobs in this category

    {% if last_page > 1 %}
    - page <strong>{{ current_page }}/{{ last_page }}</strong>
    {% endif %}
</div>
{% endblock %}